package io.github.iogogogo;

import io.github.iogogogo.commons.util.DateTimeUtils;
import io.github.iogogogo.web.annotation.EnableHttpLogAspect;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.info.GitProperties;

/**
 * Created by tao.zeng on 2024/11/7.
 */
@Slf4j
@EnableHttpLogAspect
@SpringBootApplication
@MapperScan("io.github.iogogogo.mapper")
public class MultipleDatasourceApplication implements CommandLineRunner {

    private final static Logger LOGGER = LoggerFactory.getLogger("customerLog");

    @Resource
    private GitProperties gitProperties;

    public static void main(String[] args) {
        SpringApplication.run(MultipleDatasourceApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        LOGGER.info("customer logger appender");
        log.info("{} multiple datasource start completed {}.", DateTimeUtils.nowDateTime(), gitProperties.getShortCommitId());
    }
}